package com.shop.clientorder.consumer;

import com.shop.clientorder.domain.OmsOrder;
import com.shop.clientorder.service.IOmsOrderService;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author：作者姓名
 * @Package：com.shop.clientorder.consumer
 * @Project：e-commerce-services
 * @name：OrderDelayed
 * @Date：2024/7/14 10:58
 */
@Component
public class OrderDelayed {
    @Autowired
    private IOmsOrderService orderService;
    @RabbitListener(queuesToDeclare = @Queue("ORDER_DELAYDE"))
    public void payOrder(OmsOrder omsOrder){
        Integer status=orderService.findOrderStatusByOrderSn(omsOrder.getOrderSn());
        if (status==0){
            orderService.updateOrder(omsOrder.getOrderSn());
        }
    }
}
